﻿
@{
    ViewData["Title"] = "标识单复审ListTwo";
}

@section Scripts
    {
    <link href="~/css/page.css" rel="stylesheet" />
    <script type="text/html" id="barAction">
        <a class="layui-btn layui-btn-xs" lay-event="edit">审核</a>
    </script>
    <script type="text/javascript">
        var selfLayer = null, page = 1, active = null;
        layui.use(['layer', 'table', 'laydate'], function () {
            var layer = layui.layer //弹层
                ,
                table = layui.table, form = layui.form; //表格
            layui.laydate.render({
                elem: '#RecordTime',
                type: 'month',
                range: true
            })

            //企业
            picker.GetEnterpriseList(layui.form);

            //执行一个 table 实例
            table.render({
                id: 'dataList',
                elem: '#dataview',
                height: 'full-80',
                url: "/SignageApplication/GetSignageApplicationTwoAll",
                headers: { 'Authorization': 'Bearer ' + localStorage.getItem("X-TOKEN") },
                where: { status: "2" },
                request: {
                    pageName: 'index' //页码的参数名称，默认：page
                    , limitName: 'size' //每页数据量的参数名，默认：limit
                },
                parseData: function (res) { //res 即为原始返回的数据
                    console.log(res);
                    return {
                        "code": res.code, //解析接口状态
                        "msg": res.msg, //解析提示文本
                        "count": res.total, //解析数据长度
                        "data": res.result.data //解析数据列表
                    };
                },
                response: {
                    statusCode: 200 //规定成功的状态码，默认：0
                },
                done: function (res, curr, count) {
                    page = curr;
                },
                page: true,
                cols: [
                    [
                        {
                            field: 'registeredTime', title: '创建时间', width: '10%',
                             templet : "<div>{{layui.util.toDateString(d.registeredTime, 'yyyy年MM月dd日')}}</div>"
                        },
                        { field: 'enterpriseName', title: '申请企业', width: '10%' },
                        { field: 'person', title: '申请人', width: '10%' },
                        { field: 'speciesName', title: '申请产品', width: '10%' },
                        { field: 'applyNum', title: '申请数量', width: '8%' },
                        { field: 'oneToExamineNum', title: '初审数量', width: '8%' },
                        { field: 'twoToExamineNum', title: '复审数量', width: '8%' },
                        { field: 'purpose', title: '申请备注', width: '10%' },
                        { field: 'status', title: '状态', width: '10%',templet: function (d) {
                            if (d.status == 0) { return '申请中' }
                            else if (d.status == 2) { return '初审' }
                            else if (d.status == 3) { return '复审' }
                            else if (d.status == -2) { return '申请驳回' }
                            else if (d.status == 5) { return '配发完成' }
                            } },
                        //  { title: '状态', align: 'center', toolbar: '#remarks', width: '10%' },
                        { fixed: 'right', width: '12%', title: '操作', align: 'center', toolbar: '#barAction' }
                    ]
                ]
            });

            var $b = layui.$;
            active = {
                reload: function (page) {
                    //执行重载
                    table.reload('dataList', {
                        page: {
                            curr: page || 1 //重新从第 1 页开始
                        },
                        where: {
                            sasearch: $("#keyword").val(),
                            status: $("#status").val(),
                            enterpriseId: $("#enterprise").val(),
                        }

                    });
                }
            };
            $b('#search').on('click', function () {
                var type = $b(this).data('type');
                active[type] ? active[type].call(this) : '';
            });
            //监听工具条
            table.on('tool(datalist)', function (obj) { //注：tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
                var data = obj.data //获得当前行数据
                    ,
                    layEvent = obj.event; //获得 lay-event 对应的值
                if (layEvent === 'edit') {
                    window.location.href = "/SignageApplication/TwoReview/" + data.id;
                }
            });
        });
    </script>
}

<blockquote class="layui-elem-quote layui-text layui-form">
    <div class="layui-inline">
        <label class="layui-form-label">关键字：</label>
        <div class="layui-input-inline">
            <input type="text" class="layui-input" id="keyword" name="keyword" style="width:210px" placeholder="">
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label">所属公司：</label>
        <div class="layui-input-inline">
            <select id="enterprise" name="modules" lay-verify="required" lay-search="">
            </select>
        </div>
    </div>
    <div class="layui-inline">
        <div class="layui-form-label">
            <button class="layui-btn" id="search" style="width: 60px; height: 28px; line-height: 28px; display: inline" data-type="reload">搜索</button>
        </div>
    </div>
</blockquote>
<table class="layui-hide" id="dataview" lay-filter="datalist"></table>

